package com.jp.knowledge.adapter.skill;

import android.content.Context;
import android.support.annotation.NonNull;
import android.view.View;
import android.widget.TextView;

import com.jp.knowledge.R;
import com.jp.knowledge.model.PositionKnowlegeMode;
import com.jp.knowledge.model.SkillModel;
import com.jp.knowledge.my.base.RecycleVAdapter;
import com.jp.knowledge.my.base.RecycleVHolder;

import java.util.List;

/**
 * Created by 528787067@qq.com on 2017/4/21.
 */

public class SkillDetailPopupWindowMainAdapter extends RecycleVAdapter<PositionKnowlegeMode.ListBeanX> {

    private int position;

    public SkillDetailPopupWindowMainAdapter(Context context, @NonNull List<PositionKnowlegeMode.ListBeanX> list, int position) {
        super(context, list);
        this.position = position;
    }

    public void setPosition(int position){
        this.position = position;
    }

    public int getPosition(){
        return position;
    }

    @Override
    public int getLayoutId(int viewType) {
        return R.layout.item_skill_detail_main;
    }

    @Override
    public void onBind(RecycleVHolder holder, int position) {
        TextView title = holder.getTextView(R.id.item_title);
        title.setText(getData(position).getName());
        if(this.position == position){
            title.setTextColor(mContext.getResources().getColor(R.color.theme_color));
            holder.get(R.id.item_mark_view).setVisibility(View.VISIBLE);
            holder.getConvertView().setBackgroundColor(mContext.getResources().getColor(R.color.white));
        } else{
            title.setTextColor(mContext.getResources().getColor(R.color.font_black_think));
            holder.get(R.id.item_mark_view).setVisibility(View.GONE);
            holder.getConvertView().setBackgroundColor(0);
        }
    }
}
